package com.itheima.druid;

import com.itheima.myConPool.DataSourceUtils;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class DruidTest02 {
    public static void main(String[] args) throws Exception{
        Connection con = DataSourceUtils.getConnection();
        String sql = "select * from student";
        PreparedStatement ps = con.prepareStatement(sql);
        ResultSet res = ps.executeQuery();
        //3.处理结果集
        while(res.next()) {
            System.out.println(res.getInt("sid") + "\t" + res.getString("name") + "\t" + res.getInt("age") + "\t" + res.getDate("birthday"));
        }
        DataSourceUtils.close(con,ps,res);
    }
}
